Repository navigation
Conversation
<!-- --> Fixes dotnet#136373. Treat delegate receivers of explicit tail calls as escaping. Tailcall helpers require the original delegate and can use it after the caller's frame returns, so stack allocation is unsafe. Adds a small F# regression test that tailcalls a freshly created delegate with enough arguments to require the helpers. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7bb954bf-2cce-4297-acb5-e4f5e2cb32b2 (cherry picked from commit a01cb86)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8c6b9802-8643-479e-bbb4-f4e04e60fc0a
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
jakobbotsch
approved these changes
Dec 1, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Issue #136373
main PR #136408
Description
Backport of #136408 to release/10.0. Object stack allocation could stack-allocate a delegate whose
Invokeis an explicit tail call. When that tail call goes through the runtime's tailcall helpers, the JIT passes the wrong object as the delegate. The fix treats the receivers of tail-prefixed delegate invokes as escaping.Customer Impact
Uncatchable AV in F# Release builds (tail calls are on by default) when a delegate is invoked in tail position. The only workaround is
DOTNET_JitObjectStackAllocation=0. Backport requested in #138547.Regression
Introduced in .NET 10 by delegate stack allocation (#115172). Works on .NET 9.
Testing
Test is backported as a standalone F# test (release/10.0 does not run F# tests in merged runners). Verified it crashes on 10.0.15 without the fix.
Risk
Low. Only makes escape analysis more conservative for explicit tail calls, no diffs in main.
Note
PR description generated with GitHub Copilot.